reftests: Make label-text-shadow-changes-modify-clip test more reliable
authorMatthias Clasen <mclasen@redhat.com>
Sun, 31 Jan 2016 19:08:35 +0000 (14:08 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 31 Jan 2016 19:11:01 +0000 (14:11 -0500)
This test was failing in continuous, where the tests are running
in a VM with disabled animations. Make the test adapt to that
situation by changing the rui on the fly if we find that animations
are disabled.

testsuite/reftests/label-text-shadow-changes-modify-clip.c
testsuite/reftests/label-text-shadow-changes-modify-clip.ui

index 0507c36c441436dbbf31cc47589346d3c7a7e6db..bfb2d6028cdd9ab5302351a0a434cea3b7e1d624 100644 (file)
@@ -88,3 +88,21 @@ inhibit_for_3_frames (GtkWidget *widget)
 
   return FALSE;
 }
+
+G_MODULE_EXPORT gboolean
+add_reference_class_if_no_animation (GtkWidget *widget)
+{
+  gboolean enabled;
+  GtkStyleContext *context;
+
+  g_object_get (gtk_widget_get_settings (widget), "gtk-enable-animations", &enabled, NULL);
+  if (enabled)
+    return FALSE;
+
+  g_message ("Adding reference class because animation is disabled");
+
+  context = gtk_widget_get_style_context (widget);
+  gtk_style_context_add_class (context, "reference");
+
+  return FALSE;
+}
index 0d029fd0a2daffda1ba9be183a0a8c2d21d4a8ff..3acad7e63650aca77fa9c7af5485106b568a660c 100644 (file)
@@ -20,6 +20,7 @@
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="label" translatable="yes">Hello World</property>
+            <signal name="map" handler="reftest:add_reference_class_if_no_animation" swapped="no"/>
           </object>
           <packing>
             <property name="expand">False</property>